[BLKTAP] Use lartge enough types to express parameters of large block devices.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 28 Nov 2006 13:50:32 +0000 (13:50 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 28 Nov 2006 13:50:32 +0000 (13:50 +0000)
commitbc7926798919a5523af71386727493ef5aa5fd7d
tree0fe6e25101fe460f555468f62ecaede4fd6887cb
parent5348ff2ec07add9d95b67bef3a5ae7f85ee4b393
[BLKTAP] Use lartge enough types to express parameters of large block devices.

While the kernel side of blktap drivers is using 64-bit sector numbers
correctly when reporting disk sizing, the userspace parts where this
dat is actually generated is truncating at 32-bit. There are 3 variables
related to disk sizing which are used in the kernel/userspace code
'size', 'sector size' & 'info'. In kernel space these are treated as being
unsigned long long, unsigned long, and unsigned int, respectively. In
the blktap userspace code this were all varyingly long, unsigned long.
This mismatch caused 32-bit wraparound on large disks. The attached
patch updates the blktap userspace to use the same data types as
kernel space for all these params, thus both fixing the 32-bit bug &
giving the code consistency.

This patch has been tested both by comparing /proc/partitions in the
guest, with the image size seen in the host, and by using Stephen
Tweedie's 'verify-data' tool on a variety of multi-TB sized disks.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tools/blktap/drivers/blktapctrl.c
tools/blktap/drivers/blktapctrl.h
tools/blktap/drivers/tapdisk.h
tools/blktap/lib/blktaplib.h
tools/blktap/lib/xenbus.c